<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>

<div id="app">
    <h2>注册界面</h2>
    <input type="text" placeholder="Username" v-model="name">
    <input type="text" placeholder="Password" v-model="password">
    男<input type="radio" value=0 v-model="gender">
    女<input type="radio" value=1 v-model="gender">
    <input type="text" placeholder="age" v-model="age">
    <input type="submit" value="提交" @click="register">
</div>

<script src="https://unpkg.com/axios/dist/axios.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/vue@2/dist/vue.js"></script>

<script>
    const app = new Vue({
        el: '#app',
        data: {
            name: '',
            password: '',
            gender: 0,
            age: 0
        },
        methods: {
            register() {
                axios.post('http://localhost:8080/api/register', {
                    name:this.name,
                    password:this.password,
                    gender:this.gender,
                    age:this.age
                })
                    .then(res=>{
                        console.log(this.name);
                        console.log(this.gender);
                        console.log(res)
                })
            }
        }
    })

</script>
</body>
</html>